home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swaga_c.zip / CMDLINE.SWG / 0009_Handling PARAMSTR.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  2KB  |  53 lines

  1. {
  2. > It Word wrapped one line but you get the idea.  Is there an easier or
  3. > faster way to do this?
  4. }
  5. Var
  6.   Num, Code : Integer;
  7.   Par : String;
  8.  
  9. For F := 2 To ParamCount Do
  10.  begin
  11.  If Pos('/', ParamStr(F)) = 1 Then
  12.    P := Copy(ParamStr(F), 2, 2);
  13.  
  14.  If (Pos('A', P) = 1) Or (Pos('a', P) = 1) Then
  15.  begin
  16.    Val(Copy(P, 2, 1), Num, Code);
  17.    If Num In [1..5] Then
  18.      ReadString(Num);
  19.  end;
  20.  If (Pos('O',P) = 1) Or (Pos('o',P) = 1) Then Overide := False;
  21.  If (Pos('S',P) = 1) Or (Pos('s',P) = 1) Then Spin := False;
  22.  If (Pos('F',P) = 1) Or (Pos('f',P) = 1) Then ComLine(1,200);
  23.  If (Pos('C',P) = 1) Or (Pos('c',P) = 1) Then ComLine(2,200);
  24.  If (Pos('R',P) = 1) Or (Pos('r',P) = 1) Then
  25.  begin
  26.    Val(Copy(P, 2, 1), Num, Code);
  27.    If Num In [0..10] Then
  28.      Comline(3, Num);
  29.  end;
  30.  If (Pos('L',P) = 1) Or (Pos('l',P) = 1) Then ComLine(4,200);
  31.  If (Pos('M',P) = 1) Or (Pos('m',P) = 1) Then ComLine(Random(4)+1,0);
  32.  If (Pos('B',P) = 1) Or (Pos('b',P) = 1) Then DirectVideo := False;
  33.  If (Pos('P',P) = 1) Or (Pos('p',P) = 1) Then
  34.  begin
  35.    Val(Copy(P, 2, 1), Num, Code);
  36.    If Num In [0..3] Then
  37.      Comline(5,200+Num);
  38.  end;
  39.  If (Pos('E',P) = 1) Or (Pos('p',P) = 1) Then ReturnLevel := True;
  40.  If (Pos('?',P) = 1) Then Error;
  41. end;
  42.  
  43. {
  44. Some Notes:
  45.    I am not sure if it will return a 0 when the it asks For Val(Copy(P, 2, 1),
  46. Num, Code) and the P Variable isn't R1, R2, R3, etc (when it is just R from a
  47. /R) so you may have to trap that one differently or change the Program so they
  48. have to say /R0 instead of /R.  I hope you follow the rest of the code and I
  49. hope it works.  I have no idea what your Program is For so I couldn't test it
  50. either (too lazy am I?  I think not... The above wasn't too easy to do!) So I
  51. hope it works and good luck...
  52. }
  53.